{include file='./inc/header.tpl'}
<div id="wrap">
    {include file='./inc/head.tpl'}
    <div id="contents">
        <div class="ttl">
            <h2>
                カテゴリ一覧
            </h2>
        </div>
        <div class="menuArea">
            <div class="btn primary" onclick="location.href='./admin/category_edit'">新規登録</div>
        </div>
        {if !empty($category)} {include file='./inc/message.tpl'}
        <form name="form1" id="form1" action="./admin/category" method="post">
            <input type="hidden" name="transid" value="{$transactionid}">
            <input type="hidden" name="mode" value="">
            <input type="hidden" name="category_id" value="">
            <!--{foreach from=$arrHidden key="key" item="item"}-->
                <!--{if is_array($item)}-->
                    <!--{foreach item=c_item from=$item}-->
                        <input type="hidden" name="{$key}[]" value="{$c_item}" />
                    <!--{/foreach}-->
                <!--{else}-->
                    <input type="hidden" name="{$key}" value="{$item}" />
                <!--{/if}-->
            <!--{/foreach}-->
            <table>
                <thead>
                    <th>カテゴリ名</th>
                    <th>登録日</th>
                    <th>更新日</th>
                    <th></th>
                </thead>
               結果：{$category_cnt}件
                <br />
                <br />
                <tbody>
                    {foreach from=$category item=item name=count}
                    <tr class="selectTarget {if ($smarty.foreach.count.index +1) % 2 == 0}even{/if}">
                        <td>{$item.category_name}</td>
                        <td>{$item.regist_datetime}</td>
                        <td>{$item.lastup_datetime}</td>
                        <td>
                            <a href="javascript:;" onclick="edit({$item.category_id});">
                                <span class="btn">編集</span>
                            </a> <a href="javascript:;" onclick="submitForm('form1','delete','category_id',{$item.category_id});">
                                <span class="btn">削除</span>
                            </a>
                        </td>
                    </tr>
                    {/foreach}
                </tbody>
            </table>
            <div class="pager">
                <ul>{$pager}
                </ul>
            </div>
        </form>
        <script type="text/javascript">
        function edit(id){
        	document.form1.action = './admin/category_edit';
        	document.form1['category_id'].value = id;
        	document.form1['mode'].value = 'pre_edit';
        	document.form1.submit();
        }
        </script>
        {else}
        <div style="color: red;">データがありません。</div>
        {/if}
    </div>
    <!-- #contents -->
</div>
<!-- #wrap -->
{include file='./inc/footer.tpl'}
